package liuwanghui.mapper;

import liuwanghui.dto.request.ProductQueryDTO;
import liuwanghui.dto.request.StockLogDTO;
import liuwanghui.pojo.Inventory;
import liuwanghui.pojo.Product;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Mapper
public interface FarmerMapper {
    List<Product> findProducts(ProductQueryDTO params);
    Product findProductById(@Param("id") Long id);
    void insertProduct(Product product);
    void updateProduct(Product product);
    void deleteProduct(@Param("id") Long id);
    void updateProductStatus(@Param("id") Long id, @Param("status") String status);
    Map<String, Object> getDashboardStats(@Param("startTime") LocalDateTime startTime, 
                                        @Param("endTime") LocalDateTime endTime);
    
    // 库存相关
    void insertInventory(Inventory inventory);
    Inventory findInventoryByProductId(@Param("productId") Long productId);
    void updateInventoryStock(Inventory inventory);
    void insertStockLog(StockLogDTO log);
}